import { getTreeChannelApi } from "@/api/configCenter/warehouseEntryChannel";
import { reactive } from "vue";

export const formItemColumnMap: Base.GeneraDataType<Array<{ name: string; label: string }>> = {
  1: [
    {
      name: "customerName",
      label: "客户简称"
    },
    {
      name: "bizName",
      label: "业务员"
    },
    {
      name: "createName",
      label: "财务"
    },
    // {
    //   name: "remark",
    //   label: "账单备注"
    // },
    {
      name: "accountName",
      label: "结算账期"
    }
  ],
  2: [
    {
      name: "customerName",
      label: "客户简称"
    },
    {
      name: "bizName",
      label: "业务员"
    },
    {
      name: "createName",
      label: "财务"
    },
    {
      name: "accountName",
      label: "结算账期"
    }
  ]
};
export const searchItemList: Array<SuperSearch.SearchItem> = [
  {
    type: "input",
    label: "运单号",
    keyName: "waybillNums",
    placeholder: "支持批量(空格/逗号隔开)"
  },
  {
    type: "select",
    label: "核销状态",
    keyName: "state",
    optConfig: {
      label: "name",
      value: "code"
    },
    options: [
      {
        name: "未核销",
        code: 0
      },
      {
        name: "部分核销",
        code: 1
      },
      {
        name: "已核销",
        code: 2
      },
      {
        name: "已撤回",
        code: 3
      }
    ]
  },
  reactive<SuperSearch.SearchItem>({
    type: "cascader",
    label: "渠道",
    keyName: "channelId",
    optionsRequest: getTreeChannelApi,
    optReqParams: {},
    optReqCb: (res: Base.GeneraDataType, row: SuperSearch.SearchItem) => {
      const { code, data } = res;
      if (code === 200) {
        row.options = data || [];
      }
    },
    optConfig: {
      label: "label",
      value: "value",
      children: "children"
    },
    options: []
  }),
  {
    type: "daterange",
    label: "拣货时间",
    keyName: "depositTime"
  },
  {
    type: "input",
    label: "费用名称",
    keyName: "costName"
  }
];
